package com.example.panpan.system.controller;

import com.example.common.utils.IMap;
import com.example.common.utils.ReturnMapUtils;
import com.example.panpan.system.model.CompanyInfo;
import com.example.panpan.system.service.PanpanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@Controller
public class companyInfoCon {
    @Autowired
    private PanpanService panpanService;
    /**
     * 公司介绍设置
     * */
    @RequestMapping(value = "/companyInfo/toPage/companyInfoView")
    public String companyInfoView ( ModelMap modelMap){
        CompanyInfo companyInfo = panpanService.returnMyCompany();
        modelMap.addAttribute("companyInfo",companyInfo);
        return "/module/companyInfo";
    }
    @RequestMapping(value = "/companyInfo/ajax/updCompanyInfo",method = RequestMethod.POST)
    @ResponseBody
    public Map updCompanyInfo(HttpServletRequest request){
        IMap params = new IMap(request);
        int i = panpanService.updCompanyInfo(params);
        if (i==1){
            return ReturnMapUtils.businessResult("0000","操作成功！");
        }else {
            return ReturnMapUtils.businessResult("9999","服务器错误，操作失败！");
        }
    }
}
